<template>
  <div style="padding-top: 10px">
    <!-- 预设面板 -->
    <el-row :gutter="0">
      <!-- 奖项设置面板 -->
      <el-col :span="8">
        <!-- Tab -->
        <el-tabs type="border-card" style="margin-left: 5px; margin-top: 5px">
          <el-row :gutter="0">
            <el-col :span="12"><h3>企业认证奖项设置</h3></el-col>
            <el-col :span="12"><el-button type="success" style="float: right" @click="handleOpenAwardPanel">新增奖项</el-button></el-col>
          </el-row>
        </el-tabs>
        <!-- 预设列表 -->
        <el-tabs type="border-card" style="margin-left: 5px; margin-top: 5px">
          <el-form :model="form.awardList" label-width="60px" ref="form.awardList">
            <el-collapse v-model="pageData.awardActive">
              <el-collapse-item :title="item.awardsTitle" :name="item.awardsId" v-for="(item,index) in form.awardList" :key="item.awardsId">
                <!-- 奖项名称、分享名称 -->
                <el-row :gutter="0">
                  <el-col :span="12">
                    <el-form-item label="奖项名">
                      <el-input v-model="item.awardsTitle"></el-input>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item label="分享名">
                      <el-input v-model="item.awardsIntroduceTitle"></el-input>
                    </el-form-item>
                  </el-col>
                </el-row>
                <!-- 展示顺序、启用状态 -->
                <el-row :gutter="0">
                  <el-col :span="12">
                    <el-form-item label="顺序">
                      <el-input v-model="item.awardsShowIndex"></el-input>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item label="状态">
                      <el-radio v-model="item.awardsStatus" :label="0">禁用</el-radio>
                      <el-radio v-model="item.awardsStatus" :label="1">启用</el-radio>
                    </el-form-item>
                  </el-col>
                </el-row>
                <!-- 奖项图、分享图 -->
                <el-row :gutter="0">
                  <el-col :span="12">
                    <el-form-item label="奖项图">
                      <el-upload
                        class="avatar-uploader"
                        action="/api/cms/common/uploadFile"
                        :show-file-list="false"
                        :on-success="handleAwardListAwardImageUploadSuccess">
                        <img v-if="item.awardsImage" :src="item.awardsImage" class="avatar" @click="handleAwardListAwardImageUploadBefore(index)">
                        <i v-else class="el-icon-plus avatar-uploader-icon" style="line-height: 175px" @click="handleAwardListAwardImageUploadBefore(index)"></i>
                      </el-upload>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item label="分享图">
                      <el-upload
                        class="avatar-uploader"
                        action="/api/cms/common/uploadFile"
                        :show-file-list="false"
                        :on-success="handleAwardListAwardShareImageUploadSuccess">
                        <img v-if="item.awardsIntroduceImage" :src="item.awardsIntroduceImage" class="avatar" @click="handleAwardListAwardShareImageUploadBefore(index)">
                        <i v-else class="el-icon-plus avatar-uploader-icon" style="line-height: 175px" @click="handleAwardListAwardShareImageUploadBefore(index)"></i>
                      </el-upload>
                    </el-form-item>
                  </el-col>
                </el-row>
                <!-- 简介 -->
                <el-row :gutter="0">
                  <el-col :span="24">
                    <el-form-item label="简介">
                      <el-input v-model="item.awardsInfo" type="textarea" :rows="4"></el-input>
                    </el-form-item>
                  </el-col>
                </el-row>
                <!-- 文本 -->
                <el-row :gutter="0">
                  <el-col :span="24">
                    <vue-ueditor-wrap v-model="item.awardsIntroduceHtml" :config="CompanyInfoPageTextEditorConfig"></vue-ueditor-wrap>
                  </el-col>
                </el-row>
              </el-collapse-item>
            </el-collapse>
            <el-button type="primary" style="margin-top: 10px" @click="handleAwardUpdateButtonClick">保存奖项</el-button>
          </el-form>
        </el-tabs>
      </el-col>
      <!-- 业务范围设置面板 -->
      <el-col :span="8">
        <!-- Tab -->
        <el-tabs type="border-card" style="margin-left: 5px; margin-top: 5px">
          <el-row :gutter="0">
            <el-col :span="12"><h3>企业业务范围设置</h3></el-col>
            <el-col :span="12"><el-button type="success" style="float: right" @click="handleOpenBusinessPanel">新增业务</el-button></el-col>
          </el-row>
        </el-tabs>
        <!-- 预设列表 -->
        <el-tabs type="border-card" style="margin-left: 5px; margin-top: 5px">
          <el-form :model="form.businessList" label-width="60px" ref="form.businessList">
            <el-collapse v-model="pageData.businessActive">
              <el-collapse-item :title="item.businessTitle" :name="item.businessId" v-for="(item,index) in form.businessList" :key="item.businessId">
                <!-- 业务名称、展示顺序 -->
                <el-row :gutter="0">
                  <el-col :span="12">
                    <el-form-item label="业务名">
                      <el-input v-model="item.businessTitle"></el-input>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item label="顺序">
                      <el-input v-model="item.businessShowIndex"></el-input>
                    </el-form-item>
                  </el-col>
                </el-row>
                <!-- 发布状态 -->
                <el-row :gutter="0">
                  <el-col :span="24">
                    <el-form-item label="状态">
                      <el-radio v-model="item.businessStatus" :label="0">禁用</el-radio>
                      <el-radio v-model="item.businessStatus" :label="1">启用</el-radio>
                    </el-form-item>
                  </el-col>
                </el-row>
                <!-- 业务图 -->
                <el-row :gutter="0">
                  <el-col :span="24">
                    <el-form-item label="业务图">
                      <el-upload
                        class="avatar-uploader"
                        action="/api/cms/common/uploadFile"
                        :show-file-list="false"
                        :on-success="handleBusinessListBusinessImageUploadSuccess">
                        <img v-if="item.businessImage" :src="item.businessImage" class="avatar" @click="handleBusinessListBusinessImageUploadBefore(index)">
                        <i v-else class="el-icon-plus avatar-uploader-icon" style="line-height: 175px"></i>
                      </el-upload>
                    </el-form-item>
                  </el-col>
                </el-row>
                <!-- 简介 -->
                <el-row :gutter="0">
                  <el-col :span="24">
                    <el-form-item label="简介">
                      <el-input v-model="item.businessInfo" type="textarea" :rows="4"></el-input>
                    </el-form-item>
                  </el-col>
                </el-row>
              </el-collapse-item>
            </el-collapse>
            <el-button type="primary" style="margin-top: 10px" @click="handleBusinessUpdateButtonClick">保存业务</el-button>
          </el-form>
        </el-tabs>
      </el-col>
      <!-- 案例设置面板 -->
      <el-col :span="8">
        <!-- Tab -->
        <el-tabs type="border-card" style="margin-left: 5px; margin-top: 5px">
          <el-row :gutter="0">
            <el-col :span="12"><h3>企业认证案例设置</h3></el-col>
            <el-col :span="12"><el-button type="success" style="float: right" @click="handleOpenCasePanel">新增案例</el-button></el-col>
          </el-row>
        </el-tabs>
        <!-- 预设列表 -->
        <el-tabs type="border-card" style="margin-left: 5px; margin-top: 5px">
          <el-form :model="form.caseList" label-width="60px" ref="form.caseList">
            <el-collapse v-model="pageData.caseActive">
              <el-collapse-item :title="item.caseTitle" :name="item.caseId" v-for="(item,index) in form.caseList" :key="item.caseId">
                <!-- 案例名、分享名 -->
                <el-row :gutter="0">
                  <el-col :span="12">
                    <el-form-item label="案例名">
                      <el-input v-model="item.caseTitle"></el-input>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item label="分享名">
                      <el-input v-model="item.caseIntroduceTitle"></el-input>
                    </el-form-item>
                  </el-col>
                </el-row>
                <!-- 展示顺序、审核状态 -->
                <el-row :gutter="0">
                  <el-col :span="12">
                    <el-form-item label="顺序">
                      <el-input v-model="item.caseShowIndex"></el-input>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item label="状态">
                      <el-radio v-model="item.caseStatus" :label="0">禁用</el-radio>
                      <el-radio v-model="item.caseStatus" :label="1">启用</el-radio>
                    </el-form-item>
                  </el-col>
                </el-row>
                <!-- 案例图、分享图 -->
                <el-row :gutter="0">
                  <el-col :span="12">
                    <el-form-item label="案例图">
                      <el-upload
                        class="avatar-uploader"
                        action="/api/cms/common/uploadFile"
                        :show-file-list="false"
                        :on-success="handleCaseListCaseImageUploadSuccess">
                        <img v-if="item.caseImage" :src="item.caseImage" class="avatar" @click="handleCaseListCaseImageUploadBefore(index)">
                        <i v-else class="el-icon-plus avatar-uploader-icon" style="line-height: 175px" @click="handleCaseListCaseImageUploadBefore(index)"></i>
                      </el-upload>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item label="分享图">
                      <el-upload
                        class="avatar-uploader"
                        action="/api/cms/common/uploadFile"
                        :show-file-list="false"
                        :on-success="handleCaseListCaseShareImageUploadSuccess">
                        <img v-if="item.caseIntroduceImage" :src="item.caseIntroduceImage" class="avatar" @click="handleCaseListCaseShareImageUploadBefore(index)">
                        <i v-else class="el-icon-plus avatar-uploader-icon" style="line-height: 175px" @click="handleCaseListCaseShareImageUploadBefore(index)"></i>
                      </el-upload>
                    </el-form-item>
                  </el-col>
                </el-row>
                <!-- 简介 -->
                <el-row :gutter="0">
                  <el-col :span="24">
                    <el-form-item label="简介">
                      <el-input v-model="item.caseInfo" type="textarea" :rows="4"></el-input>
                    </el-form-item>
                  </el-col>
                </el-row>
                <!-- 文本 -->
                <el-col :span="24">
                  <vue-ueditor-wrap v-model="item.caseIntroduceHtml" :config="CompanyInfoPageTextEditorConfig"></vue-ueditor-wrap>
                </el-col>
              </el-collapse-item>
            </el-collapse>
            <el-button type="primary" style="margin-top: 10px" @click="handleCaseUpdateButtonClick">保存案例</el-button>
          </el-form>
        </el-tabs>
      </el-col>
    </el-row>
    <!-- 奖项新增隐藏域 -->
    <el-dialog title="奖项新增" :visible.sync="pageData.awardStatus" width="1024"
               :before-close="handleCloseAwardPanel">
      <el-form ref="form.award" :model="form.award" label-width="80px">
        <!-- 奖项名称、分享名称、展示顺序、启用状态 -->
        <el-row :gutter="0">
          <el-col :span="6">
            <el-form-item label="奖项名">
              <el-input v-model="form.award.awardsTitle"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="分享名">
              <el-input v-model="form.award.awardsIntroduceTitle"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="顺序">
              <el-input v-model="form.award.awardsShowIndex"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="状态">
              <el-radio v-model="form.award.awardsStatus" label="0">禁用</el-radio>
              <el-radio v-model="form.award.awardsStatus" label="1">启用</el-radio>
            </el-form-item>
          </el-col>
        </el-row>
        <!-- 奖项图、分享图 -->
        <el-row :gutter="0">
          <el-col :span="12">
            <el-form-item label="奖项图">
              <el-upload
                class="avatar-uploader"
                action="/api/cms/common/uploadFile"
                :show-file-list="false"
                :on-success="handleAwardImageUploadSuccess">
                <img v-if="form.award.awardsImage" :src="form.award.awardsImage" class="avatar">
                <i v-else class="el-icon-plus avatar-uploader-icon" style="line-height: 175px"></i>
              </el-upload>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="分享图">
              <el-upload
                class="avatar-uploader"
                action="/api/cms/common/uploadFile"
                :show-file-list="false"
                :on-success="handleAwardShareImageUploadSuccess">
                <img v-if="form.award.awardsIntroduceImage" :src="form.award.awardsIntroduceImage" class="avatar">
                <i v-else class="el-icon-plus avatar-uploader-icon" style="line-height: 175px"></i>
              </el-upload>
            </el-form-item>
          </el-col>
        </el-row>
        <!-- 简介 -->
        <el-row :gutter="0">
          <el-col :span="24">
            <el-form-item label="简介">
              <el-input v-model="form.award.awardsInfo" type="textarea" :rows="4"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <!-- 文本 -->
        <el-row :gutter="0">
          <el-col :span="24">
            <vue-ueditor-wrap v-model="form.award.awardsIntroduceHtml" :config="CompanyInfoPageTextEditorConfig"></vue-ueditor-wrap>
          </el-col>
        </el-row>
        <el-form-item>
          <el-button type="primary" @click="handleAwardSaveButtonClick">保存奖项</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>
    <!-- 业务新增隐藏域 -->
    <el-dialog title="业务新增" :visible.sync="pageData.businessStatus" width="1024"
               :before-close="handleCloseBusinessPanel">
      <el-form ref="form.business" :model="form.business" label-width="80px">
        <!-- 业务名、展示顺序、审核状态 -->
        <el-row :gutter="0">
          <el-col :span="8">
            <el-form-item label="业务名">
              <el-input v-model="form.business.businessTitle"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="顺序">
              <el-input v-model="form.business.businessShowIndex"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="状态">
              <el-radio v-model="form.business.businessStatus" :label="0">禁用</el-radio>
              <el-radio v-model="form.business.businessStatus" :label="1">启用</el-radio>
            </el-form-item>
          </el-col>
        </el-row>
        <!-- 业务图 -->
        <el-row :gutter="0">
          <el-col :span="24">
            <el-form-item label="业务图">
              <el-upload
                class="avatar-uploader"
                action="/api/cms/common/uploadFile"
                :show-file-list="false"
                :on-success="handleBusinessImageUploadSuccess">
                <img v-if="form.business.businessImage" :src="form.business.businessImage" class="avatar">
                <i v-else class="el-icon-plus avatar-uploader-icon" style="line-height: 175px"></i>
              </el-upload>
            </el-form-item>
          </el-col>
        </el-row>
        <!-- 简介 -->
        <el-row :gutter="0">
          <el-col :span="24">
            <el-form-item label="简介">
              <el-input v-model="form.business.businessInfo" type="textarea" :rows="4"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-form-item>
          <el-button type="primary" @click="handleBusinessSaveButtonClick">保存业务</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>
    <!-- 案例新增隐藏域 -->
    <el-dialog title="案例新增" :visible.sync="pageData.caseStatus" width="1024"
               :before-close="handleCloseCasePanel">
      <el-form ref="form.case" :model="form.case" label-width="80px">
        <!-- 案例名、分享名、展示顺序、启用状态 -->
        <el-row :gutter="0">
          <el-col :span="6">
            <el-form-item label="案例名">
              <el-input v-model="form.case.caseTitle"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="分享名">
              <el-input v-model="form.case.caseIntroduceTitle"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="顺序">
              <el-input v-model="form.case.caseShowIndex"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="状态">
              <el-radio v-model="form.case.caseStatus" :label="0">禁用</el-radio>
              <el-radio v-model="form.case.caseStatus" :label="1">启用</el-radio>
            </el-form-item>
          </el-col>
        </el-row>
        <!-- 案例图、分享图 -->
        <el-row :gutter="0">
          <el-col :span="12">
            <el-form-item label="案例图">
              <el-upload
                class="avatar-uploader"
                action="/api/cms/common/uploadFile"
                :show-file-list="false"
                :on-success="handleCaseImageUploadSuccess">
                <img v-if="form.case.caseImage" :src="form.case.caseImage" class="avatar">
                <i v-else class="el-icon-plus avatar-uploader-icon" style="line-height: 175px"></i>
              </el-upload>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="分享图">
              <el-upload
                class="avatar-uploader"
                action="/api/cms/common/uploadFile"
                :show-file-list="false"
                :on-success="handleCaseShareImageUploadSuccess">
                <img v-if="form.case.caseIntroduceImage" :src="form.case.caseIntroduceImage" class="avatar">
                <i v-else class="el-icon-plus avatar-uploader-icon" style="line-height: 175px"></i>
              </el-upload>
            </el-form-item>
          </el-col>
        </el-row>
        <!-- 简介 -->
        <el-row :gutter="0">
          <el-col :span="24">
            <el-form-item label="简介">
              <el-input v-model="form.case.caseInfo" type="textarea" :rows="4"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <!-- 文本 -->
        <el-row :gutter="0">
          <el-col :span="24">
            <vue-ueditor-wrap v-model="form.case.caseIntroduceHtml" :config="CompanyInfoPageTextEditorConfig"></vue-ueditor-wrap>
          </el-col>
        </el-row>
        <el-form-item>
          <el-button type="primary" @click="handleCaseSaveButtonClick">保存案例</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>
  </div>
</template>

<script>
// 组件引入
// 方法工具引入
import { PermissionsToDetectFormUser } from '@/utils/PermissionsDetect';
import { getPermission } from '@/utils/UserCookies';
// 接口引入
import { loadCmsCompanyAwardList,loadCmsCompanyBusinessList,loadCmsCompanyCaseList,saveCmsCompanyAwardData,updateCmsCompanyAwardData,
  saveCmsCompanyBusinessData,updateCmsCompanyBusinessData,saveCmsCompanyCaseData,updateCmsCompanyCaseData } from "@/api/customer";
  export default {
    name: "info",
    //import引入的组件需要注入到对象中才能使用
    components: {},
    data() {
      return {
        pageData:{
          // 奖项面板
          awardActive: "",
          awardStatus: false,
          // 业务面板
          businessActive: "",
          businessStatus: false,
          // 案例面板
          caseActive: "",
          caseStatus: false,
        },// 页面配置数据
        form:{
          // 页面参数ID
          companyAuthId: "",
          // 奖项参数
          awardList: [],
          award:{
            companyAuthId: "",
            awardsTitle: "",
            awardsImage: "",
            awardsInfo: "",
            awardsIntroduceTitle: "",
            awardsIntroduceHtml: "",
            awardsIntroduceImage: "",
            awardsStatus: 0,
            awardsShowIndex: 0
          },
          awardImageIndex: 0,
          awardShareImageIndex: 0,
          // 业务参数
          businessList: [],
          business: {
            companyAuthId: '',
            businessId: '',
            businessTitle: '',
            businessShowIndex: '0',
            businessStatus: '0',
            businessImage: '',
            businessInfo: ''
          },
          businessImageIndex: 0,
          // 案例参数
          caseList: [],
          case: {
            companyAuthId: "",
            caseId: "",
            caseTitle: "",
            caseImage: "",
            caseInfo: "",
            caseStatus: 0,
            caseIntroduceTitle: "",
            caseIntroduceHtml: "",
            caseIntroduceImage: "",
            caseShowIndex: 0
          },
          caseImageIndex: 0,
          caseShareImageIndex: 0
        },// 页面表单
        formRules: {},// 表单验证
        responseData: {},// 接口响应数据
      }
    },
    //监听属性 类似于data概念
    computed: {},
    //监控data中的数据变化
    watch: {},
    //方法集合
    methods:{
      // 方法函数
      handlePageInit(){
        let Loading = this.$loading({
          lock: true,
          text: 'Loading',
          spinner: 'el-icon-loading',
          background: 'rgba(0, 0, 0, 0.7)'
        });
        let prams = { companyAuthId: this.form.companyAuthId };
        // 读取奖项列表
        this.loadCmsCompanyAwardList(prams);
        // 读取业务范围列表
        this.loadCmsCompanyBusinessList(prams);
        // 读取案例列表
        this.loadCmsCompanyCaseList(prams)
        Loading.close();
      },// 页面初始化事件
      handleAwardListAwardImageUploadBefore(index){
        this.form.awardImageIndex = index;
      },// 预览列表上传奖项图记录下标
      handleAwardListAwardImageUploadSuccess(response){
        this.form.awardList[this.form.awardImageIndex].awardsImage = response.data;
      },// 预览列表奖项图上传成功
      handleAwardListAwardShareImageUploadBefore(index){
        this.form.awardShareImageIndex = index;
      },// 预览列表上传分享图记录下标
      handleAwardListAwardShareImageUploadSuccess(response){
        this.form.awardList[this.form.awardShareImageIndex].awardsIntroduceImage = response.data;
      },// 预览列表分享图上传成功
      handleOpenAwardPanel(){
        if (PermissionsToDetectFormUser(getPermission(), "500001")){
          // 初始化表单数据
          this.form.award.companyAuthId = this.form.companyAuthId;
          this.form.award.awardsTitle = "";
          this.form.award.awardsImage = "";
          this.form.award.awardsInfo = "";
          this.form.award.awardsIntroduceTitle = "";
          this.form.award.awardsIntroduceHtml = "";
          this.form.award.awardsIntroduceImage = "";
          this.form.award.awardsStatus = 0;
          this.form.award.awardsShowIndex = 0;
          // 打开新增面板
          this.pageData.awardStatus = true;
        } else {
          this.$message.warning('您的权限不足，无法使用此功能，请联系管理员');
        }
      },// 打开奖项新增面板
      handleCloseAwardPanel(){
        this.$confirm("确认关闭？").then(response => {
          // 初始化表单数据
          this.form.award.companyAuthId = this.form.companyAuthId;
          this.form.award.awardsTitle = "";
          this.form.award.awardsImage = "";
          this.form.award.awardsInfo = "";
          this.form.award.awardsIntroduceTitle = "";
          this.form.award.awardsIntroduceHtml = "";
          this.form.award.awardsIntroduceImage = "";
          this.form.award.awardsStatus = 0;
          this.form.award.awardsShowIndex = 0;
          // 打开新增面板
          this.pageData.awardStatus = false;
        }).catch(err => {
          console.log(err);
        });
      },// 关闭奖项新增面板
      handleAwardImageUploadSuccess(response){
        this.award.awardsImage = response.data;
      },// 新增面板奖项图上传成功
      handleAwardShareImageUploadSuccess(response){
        this.form.award.awardsIntroduceImage = response.data;
      },// 新增面板分享图上传成功
      handleAwardSaveButtonClick(){
        if (PermissionsToDetectFormUser(getPermission(), "500001")){
          this.$confirm("是否保存当前所填写的奖项数据?", "提示", {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(() => {
            this.saveCmsCompanyAwardData();
          }).catch(close => {
            console.log(close);
            this.$message.info("已取消操作");
          });
        } else {
          this.$message.warning('您的权限不足，无法使用此功能，请联系管理员');
        }
      },// 奖项保存按钮点击事件
      handleAwardUpdateButtonClick(){
        if (PermissionsToDetectFormUser(getPermission(), "500003")){
          this.$confirm("是否更新当前奖项列表?", "提示", {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(() => {
            this.updateCmsCompanyAwardData();
          }).catch(close => {
            console.log(close);
            this.$message.info("已取消操作");
          });
        } else {
          this.$message.warning('您的权限不足，无法使用此功能，请联系管理员');
        }
      },// 奖项列表更新按钮点击事件
      handleBusinessListBusinessImageUploadBefore(index){
        this.form.businessImageIndex = index;
      },// 业务列表图片上传记录下标
      handleBusinessListBusinessImageUploadSuccess(response){
        this.form.businessList[this.form.businessImageIndex].businessImage = response.data;
      },// 业务列表图片上传成功
      handleOpenBusinessPanel(){
        if (PermissionsToDetectFormUser(getPermission(), "500001")){
          // 初始化新增表单
          this.form.business.companyAuthId = this.form.companyAuthId;
          this.form.business.businessId = "";
          this.form.business.businessTitle = "";
          this.form.business.businessShowIndex = 0;
          this.form.business.businessStatus = 0;
          this.form.business.businessImage = "";
          this.form.business.businessInfo = "";
          // 打开新增面板
          this.pageData.businessStatus = true;
        } else {
          this.$message.warning('您的权限不足，无法使用此功能，请联系管理员');
        }
      },// 打开业务面板
      handleCloseBusinessPanel(){
        this.$confirm("确认关闭？").then(response => {
          // 初始化新增表单
          this.form.business.companyAuthId = "";
          this.form.business.businessId = "";
          this.form.business.businessTitle = "";
          this.form.business.businessShowIndex = 0;
          this.form.business.businessStatus = 0;
          this.form.business.businessImage = "";
          this.form.business.businessInfo = "";
          // 打开新增面板
          this.pageData.businessStatus = false;
        }).catch(err => {
          console.log(err);
        });
      },// 关闭业务面板
      handleBusinessImageUploadSuccess(response){
        this.business.businessImage = response.data;
      },// 新增面板业务图上传成功
      handleBusinessSaveButtonClick(){
        if (PermissionsToDetectFormUser(getPermission(), "500001")){
          this.$confirm("是否保存当前所填写的业务数据?", "提示", {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(() => {
            this.saveCmsCompanyBusinessData();
          }).catch(close => {
            console.log(close);
            this.$message.info("已取消操作");
          });
        } else {
          this.$message.warning('您的权限不足，无法使用此功能，请联系管理员');
        }
      },// 保存业务按钮点击事件
      handleBusinessUpdateButtonClick(){
        if (PermissionsToDetectFormUser(getPermission(), "500003")){
          this.$confirm("是否更新当前业务列表?", "提示", {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(() => {
            this.updateCmsCompanyBusinessData();
          }).catch(close => {
            console.log(close);
            this.$message.info("已取消操作");
          });
        } else {
          this.$message.warning('您的权限不足，无法使用此功能，请联系管理员');
        }
      },// 更新业务按钮点击事件
      handleCaseListCaseImageUploadBefore(index){
        this.form.caseImageIndex = index;
      },// 案例预览列表上传案例图记录下标
      handleCaseListCaseImageUploadSuccess(response){
        this.form.caseList[this.form.caseImageIndex].caseImage = response.data;
      },// 案例预览列表上传案例图成功
      handleCaseListCaseShareImageUploadBefore(index){
        this.form.caseShareImageIndex = index;
      },// 案例预览列表上传分享图记录下标
      handleCaseListCaseShareImageUploadSuccess(response){
        this.form.caseList[this.form.caseShareImageIndex].caseIntroduceImage = response.data;
      },// 案例预览列表上传分享图成功
      handleOpenCasePanel(){
        if (PermissionsToDetectFormUser(getPermission(), "500001")){
          // 初始化新增表单
          this.form.case.companyAuthId = this.form.companyAuthId;
          this.form.case.caseId = "";
          this.form.case.caseTitle = "";
          this.form.case.caseImage = "";
          this.form.case.caseInfo = "";
          this.form.case.caseStatus = 0;
          this.form.case.caseIntroduceTitle = "";
          this.form.case.caseIntroduceHtml = "";
          this.form.case.caseIntroduceImage = "";
          this.form.case.caseShowIndex = 0;
          // 打开案例新增面板
          this.pageData.caseStatus = true;
        } else {
          this.$message.warning('您的权限不足，无法使用此功能，请联系管理员');
        }
      },// 打开案例面板
      handleCloseCasePanel(){
        this.$confirm("确认关闭？").then(response => {
          // 初始化新增表单
          this.form.case.companyAuthId = "";
          this.form.case.caseId = "";
          this.form.case.caseTitle = "";
          this.form.case.caseImage = "";
          this.form.case.caseInfo = "";
          this.form.case.caseStatus = 0;
          this.form.case.caseIntroduceTitle = "";
          this.form.case.caseIntroduceHtml = "";
          this.form.case.caseIntroduceImage = "";
          this.form.case.caseShowIndex = 0;
          // 打开案例新增面板
          this.pageData.caseStatus = false;
        }).catch(err => {
          console.log(err);
        });
      },// 关闭案例面板
      handleCaseImageUploadSuccess(response){
        this.case.caseImage = response.data;
      },// 新增案例面板案例图上传成功
      handleCaseShareImageUploadSuccess(response){
        this.business.caseIntroduceImage = response.data;
      },// 新增案例面板分享图上传成功
      handleCaseSaveButtonClick(){
        if (PermissionsToDetectFormUser(getPermission(), "500001")){
          this.$confirm("是否保存当前所填写的案例数据?", "提示", {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(() => {
            this.saveCmsCompanyCaseData();
          }).catch(close => {
            console.log(close);
            this.$message.info("已取消操作");
          });
        } else {
          this.$message.warning('您的权限不足，无法使用此功能，请联系管理员');
        }
      },// 案例保存按钮点击事件
      handleCaseUpdateButtonClick(){
        if (PermissionsToDetectFormUser(getPermission(), "500003")){
          this.$confirm("是否更新当前案例列表?", "提示", {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(() => {
            this.updateCmsCompanyCaseData();
          }).catch(close => {
            console.log(close);
            this.$message.info("已取消操作");
          });
        } else {
          this.$message.warning('您的权限不足，无法使用此功能，请联系管理员');
        }
      },// 案例更新按钮点击事件
      // 接口
      loadCmsCompanyAwardList(param){
        loadCmsCompanyAwardList(param).then(response => {
          if (response.code === "200"){
            this.form.awardList = response.data;
          } else {
            this.$message.warning(response.message);
          }
        }).catch(error => {
          console.log(error);
          this.$message.error(error);
        });
      },// 获取奖项列表
      loadCmsCompanyBusinessList(param){
        loadCmsCompanyBusinessList(param).then(response => {
          if (response.code === "200"){
            this.form.businessList = response.data;
          } else {
            this.$message.warning(response.message);
          }
        }).catch(error => {
          console.log(error);
          this.$message.error(error);
        });
      },// 获取业务列表
      loadCmsCompanyCaseList(param){
        loadCmsCompanyCaseList(param).then(response => {
          if (response.code === "200"){
            this.form.caseList = response.data;
          } else {
            this.$message.warning(response.message);
          }
        }).catch(error => {
          console.log(error);
          this.$message.error(error);
        });
      },// 获取业务列表
      saveCmsCompanyAwardData(){
        saveCmsCompanyAwardData(this.form.award).then(response => {
          if (response.code === "200"){
            this.$message.success("保存成功");
            // 初始化表单数据
            this.form.award.companyAuthId = this.form.companyAuthId;
            this.form.award.awardsTitle = "";
            this.form.award.awardsImage = "";
            this.form.award.awardsInfo = "";
            this.form.award.awardsIntroduceTitle = "";
            this.form.award.awardsIntroduceHtml = "";
            this.form.award.awardsIntroduceImage = "";
            this.form.award.awardsStatus = 0;
            this.form.award.awardsShowIndex = 0;
            // 打开新增面板
            this.pageData.awardStatus = false;
            this.handlePageInit();
          } else {
            this.$message.warning(response.message);
          }
        }).catch(error => {
          console.log(error);
          this.$message.error(error);
        });
      },// 保存奖项数据
      updateCmsCompanyAwardData(){
        let param = {
          companyAward: this.form.awardList
        }
        updateCmsCompanyAwardData(param).then(response => {
          if (response.code === "200"){
            this.$message.success("保存成功");
            this.handlePageInit();
          } else {
            this.$message.warning(response.message);
          }
        }).catch(error => {
          console.log(error);
          this.$message.error(error);
        });
      },// 更新奖项列表数据
      saveCmsCompanyBusinessData(){
        saveCmsCompanyBusinessData(this.form.business).then(response => {
          if (response.code === "200"){
            this.$message.success("保存成功");
            // 初始化新增表单
            this.form.business.companyAuthId = "";
            this.form.business.businessId = "";
            this.form.business.businessTitle = "";
            this.form.business.businessShowIndex = 0;
            this.form.business.businessStatus = 0;
            this.form.business.businessImage = "";
            this.form.business.businessInfo = "";
            // 打开新增面板
            this.pageData.businessStatus = false;
            this.handlePageInit();
          } else {
            this.$message.warning(response.message);
          }
        }).catch(error => {
          console.log(error);
          this.$message.error(error);
        });
      },// 保存业务数据
      updateCmsCompanyBusinessData(){
        let param = { companyBusiness: this.form.businessList };
        updateCmsCompanyBusinessData(param).then(response => {
          if (response.code === "200"){
            this.$message.success("保存成功");
            this.handlePageInit();
          } else {
            this.$message.warning(response.message);
          }
        }).catch(error => {
          console.log(error);
          this.$message.error(error);
        });
      },// 更新业务数据
      saveCmsCompanyCaseData(){
        saveCmsCompanyCaseData(this.form.case).then(response => {
          if (response.code === "200"){
            this.$message.success("保存成功");
            // 初始化新增表单
            this.form.case.companyAuthId = "";
            this.form.case.caseId = "";
            this.form.case.caseTitle = "";
            this.form.case.caseImage = "";
            this.form.case.caseInfo = "";
            this.form.case.caseStatus = 0;
            this.form.case.caseIntroduceTitle = "";
            this.form.case.caseIntroduceHtml = "";
            this.form.case.caseIntroduceImage = "";
            this.form.case.caseShowIndex = 0;
            // 打开案例新增面板
            this.pageData.caseStatus = false;
            this.handlePageInit();
          } else {
            this.$message.warning(response.message);
          }
        }).catch(error => {
          console.log(error);
          this.$message.error(error);
        });
      },// 保存业务数据
      updateCmsCompanyCaseData(){
        let param = { companyCase: this.form.caseList };
        updateCmsCompanyCaseData(param).then(response => {
          if (response.code === "200"){
            this.$message.success("保存成功");
            this.handlePageInit();
          } else {
            this.$message.warning(response.message);
          }
        }).catch(error => {
          console.log(error);
          this.$message.error(error);
        });
      },// 更新业务数据
    },
    //生命周期 - 创建完成（可以访问当前this实例）
    created: function () {
      let _this = this;
      // 从缓存中获取当前登录用户信息
      // 获取上级页面传递参数
      _this.form.companyAuthId = _this.$route.query.companyAuthId;
      // 进行初始化数据读取
      setTimeout(function () {
        _this.handlePageInit();
      }, 800);
    },
    //生命周期 - 挂载完成（可以访问DOM元素）
    mounted() {},
    beforeCreate() {}, //生命周期 - 创建之前
    beforeMount() {}, //生命周期 - 挂载之前
    beforeUpdate() {}, //生命周期 - 更新之前
    updated() {}, //生命周期 - 更新之后
    beforeDestroy() {}, //生命周期 - 销毁之前
    destroyed() {}, //生命周期 - 销毁完成
    activated() {}, //如果页面有keep-alive缓存功能，这个函数会触发
  };
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>
